package com.yz.lzq.liwushuo.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.yz.lzq.liwushuo.R;
import com.yz.lzq.liwushuo.bean.CategroyDanPBean;

import java.util.List;

/**
 * Created by AdminJia on 2016/11/29.
 */

public class CategoryListViewAdapter extends BaseAdapter {
    private List<CategroyDanPBean.DataBean.CategoriesBean> categories = null;
    private Context mContext = null;

    public List<CategroyDanPBean.DataBean.CategoriesBean> getCategories() {
        return categories;
    }

    public CategoryListViewAdapter(List<CategroyDanPBean.DataBean.CategoriesBean> categories,
                                   Context mContext) {
        this.categories = categories;
        this.mContext = mContext;
    }

    @Override
    public int getCount() {
        return categories.size();
    }

    @Override
    public Object getItem(int i) {
        return categories.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        TextView categorylistViewTextView;
        view = LayoutInflater.from(mContext).inflate(R.layout.item_category_danp_listview,
                viewGroup, false);

        categorylistViewTextView = (TextView) view.findViewById(R.id
                .textView_category_danP_listView_item);


        categorylistViewTextView.setText(categories.get(i).getName() + "");

        return view;
    }

}
